<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <link rel="stylesheet" href="../../css/animate.css">
  <link rel="stylesheet" href="../../iconfont/iconfont.css">
  <link rel="stylesheet" href="../../css/mescroll.css">
  <link rel="stylesheet" href="../../css/gloab.css">
  <title>提现</title>
  <style>
    .form-son-input{
      line-height: 1rem;
      font-size:0.28rem;
    }
    .select{
        background-color: white;
    }
  </style>
</head>
<body>
  <div id="app">
    <div id="public-header" style="padding-bottom:1rem;">
      <div id="statusbar"></div>
      <header class="public-header">
        <div class="public-header-lf iconfont icon-fanhui" @click="javascript:api.closeWin();"></div>
        <div class="public-header-title">提现</div>
      </header>
      <div class="tixian-bar auto flex">
        <div class="tixian-bar-lf F3 flex wrap">
          <div class="tixian-bar-lf-son" style="margin-right:2.6%;" @click="one" v-bind:class="{hover: show}" v-model="5">5元</div>
          <div class="tixian-bar-lf-son" style="margin-right:2.6%;" @click="two" v-bind:class="{hover: show1}">10元</div>
          <div class="tixian-bar-lf-son" style="margin-right:2.6%;"  @click="three" v-bind:class="{hover: show2}">15元</div>
          <div class="tixian-bar-lf-son"  @click="four"  v-bind:class="{hover: show3}">20元</div>
        </div>
        <div class="tixian-bar-ipt F4" style="display:none;"><input type="text" placeholder="请输入自定义金额"></div>
        <div class="tixian-bar-rt F1" style="text-align:right;line-height:0.5rem;color:#56b1fd;display:none;">返回&nbsp;></div>
        <div class="tixian-bar-rt F1" style="text-align:right;line-height:0.5rem;color:#56b1fd;" @click="five">可自定义金额</div>
      </div>
    </div>
    <div class="fabu-body" style="margin-top:-0.6rem;background-color:#fff;">
      <div class="form-son-input flex">
        <div class="F1">金额</div>
        <div class="F3">
          <div v-if="input">
            <input  v-model='allmoney' type="text" >
          </div>
          <div v-else>
            <input  v-model='allmoney' type="text" placeholder=dateinit readonly="readonly" >
          </div>
        </div>
      </div>
      <div class="form-son-input flex">
        <div class="F1">姓名</div>
        <div class="F3">
          <input type="text" v-model='name'  placeholder="">
        </div>
      </div>
      <div class="form-son-input flex">
        <div class="F1">银行卡号</div>
        <div class="F3">
          <input type="text" v-model='banknumber' placeholder="">
        </div>
      </div>
      <div class="form-son-input flex">
        <div class="F1">选择银行</div>
        <div class="F3">
          <select class="select" name="" v-model="banktype" @click="choicebank">
            <option value="">选择银行</option>
            <option v-for="item in banktypevalue" :key="item.id" :value="item.id" :label="item.mingcheng">{{item.mingcheng}}</option>
          </select>
        </div>
      </div>
      <div class="form-son-input flex">
        <div class="F1">搜索开户行</div>
        <div class="F3">
          <input @blur="address" type="text" v-model="bankaddress" placeholder="例如‘番禺支行’则输入‘番禺’" >
        </div>
      </div>
      <div class="form-son-input flex" style="border:none;">
        <div class="F1">选择开户行</div>
        <div class="F3">
          <select class="select" name="" v-model="bank">
              <option value="">选择开户行</option>
            <option v-for="item in bankvalue" :key="item.lianhanghao" :value="item.lianhanghao" :label="item.wangdianmingcheng">{{item.wangdianmingcheng}}</option>
          </select>
        </div>
      </div>
    </div>
    <div class="vip-one-pay" @click="cash">确认提现</div>
    <div class="tixian-tishi auto" style="padding-bottom:30px;">
      <div class="tuijian-shengji-title auto">提示</div>
      <p class="auto">1、提现24小时内到帐</p>
      <p class="auto">2、5元起提。遇见问题联系客服：{{wechat}}</p>
      <p class="auto">3、提现手续费{{handlingfee}}%。</p>
    </div>
  </div>
  <div class="public-progress" style="z-index:9;">
    <img src="../../icon/icon150x150.png" alt="" class="animated infinite flash" style="width:200px;height:200px;display:block;margin:200px auto;">
  </div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/jquery.js"></script>
<script src="../../script/mescroll.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/jsencrypt.js"></script>
<script src="../../script/fastclick.js"></script>

<script>
var vm;
var mescroll;
apiready=function(){
  api.removeLaunchView();
  setBar("statusbar");
  setFont(750);
  startVue();
  $(".public-progress").fadeOut(1000);
  setTimeout(function(){
    $(".public-progress").css({"display":"none"});
  },2000);
}
function startVue(){
  vm = new Vue({
    el:"#app",
    data:{
      gdtt:['100','1000','5000','10000','20000','50000'],
      num:0,
      amoney:'5',
      bmoney:'10',
      cmoney:'15',
      dmoney:'20',
      allmoney:'5',
      name:'',
      banknumber:'',
      banktype:'',
      banktypevalue:[],
      bankaddress:'',
      bank:'',
      bankvalue:[],
      show:true,
      show1:false,
      show2:false,
      show3:false,
      input:false,
      type:'3',
      handlingfee:'',
      wechat:'',
    },
    created:function(){
      this.btype();
      this.getValue();
    },
    methods:{
      //自定义金额
      five:function(){

      },
      //金额选择样式控制
      one:function(){
          vm.show=true;
          vm.show1=false;
          vm.show2=false;
          vm.show3=false;
          vm.allmoney=vm.amoney;
      },
      two:function(){
        vm.show=false;
        vm.show1=true;
        vm.show2=false;
        vm.show3=false;
        vm.allmoney=vm.bmoney;
      },
      three:function(){
        vm.show=false;
        vm.show1=false;
        vm.show2=true;
        vm.show3=false;
        vm.allmoney=vm.cmoney;
      },
      four:function(){
        vm.show=false;
        vm.show1=false;
        vm.show2=false;
        vm.show3=true;
        vm.allmoney=vm.dmoney;
      },
      five:function(){
        vm.show=false;
        vm.show1=false;
        vm.show2=false;
        vm.show3=false;
        vm.input=true;
      },
      //银行类别
      btype:function(){
        var self = this;
        api.ajax({
            url: apiUrl+'/api/Bank/Bankselect',
            method: 'post',
        },function(ret, err){
            if (ret.status) {
              self.banktypevalue=ret.data;
            }else {
              self.banktypevalue=ret.data;
            }
        });
      },
      //银行名称
      choicebank:function(){
        vm.bankaddress="";
        vm.bank="";
      },
      address:function () {
        var self = this;
          api.ajax({
              url: apiUrl+'/api/Bank/Bankname',
              method: 'post',
              data: {
                  values: {
                      bankaddress: self.bankaddress,
                      bankid:self.banktype,
                  },
              }
          },function(ret, err){
              if (ret.status) {
                  self.bankvalue=ret.data;
              } else {
                  self.bankvalue='';
              }
          });

      },
      cash:function(){
        var self = this;
        if(self.name == "" || self.name==null){
          api.toast({
              msg: '请输入正确的姓名',
              duration: 2000,
              location: 'middle'
          });
          return;
        }
        if(self.banknumber == "" || self.banknumber==null){
          api.toast({
              msg: '银行卡号错误',
              duration: 2000,
              location: 'middle'
          });
          return;
        }
        if(!(/^\d{16}|\d{19}$/.test(self.banknumber))){
          api.toast({
              msg: '银行卡号错误',
              duration: 2000,
              location: 'middle'
          });
          return;
        }
        if (self.allmoney<5) {
          msg('最低提现不得低于5元');
          return;
        }
        var amount = (self.allmoney - self.allmoney*self.handlingfee/100).toFixed(2);
        var dialogBox = api.require('dialogBox');
        dialogBox.alert({
            texts: {
                content: '扣去手续费实际到账:'+amount+'请核对好银行卡号，提交后将在24小时内到账',
                leftBtnTitle: '取消',
                rightBtnTitle: '确认'
            },
            styles: {
                bg: '#fff',
                w: 300,
                corner:2,
                content: {
                    color: '#000',
                    size: 14
                },
                left: {
                    marginB: 7,
                    marginL: 20,
                    w: 130,
                    h: 35,
                    corner: 2,
                    bg: '#fff',
                    size: 12
                },
                right: {
                    marginB: 7,
                    marginL: 10,
                    w: 130,
                    h: 35,
                    corner: 2,
                    bg: '#fff',
                    size: 12
                }
            }
        }, function(ret) {
            if (ret.eventType == 'left') {
                var dialogBox = api.require('dialogBox');
                dialogBox.close({
                    dialogName: 'alert'
                });
                location.reload();
            }else if(ret.eventType == 'right'){
              var dialogBox = api.require('dialogBox');
              dialogBox.close({
                  dialogName: 'alert'
              });
              api.ajax({
                  url: apiUrl+'/api/Reflect/doreflect',
                  method: 'post',
                  data: {
                      values: {
                          uid: post_en($api.getStorage('uid')),
                          //uid: post_en('10000'),
                          payprice:post_en(amount),
                          name:self.name,
                          banknumber:post_en(self.banknumber),
                          banktype:self.banktype,
                          bankaddress:self.bankaddress,
                          bankname:self.bank,
                          type:post_en(vm.type),
                      },
                  }
              },function(ret, err){
                  if (ret.status) {
                    api.toast({
                        msg: "提现中",
                        duration: 2000,
                        location: 'middle'
                    });
                    setTimeout(function(){
                    api.openWin({
                      name: 'personal',
                      reload:true,
                      url:'./personal.html',
                    });
                    },500);
                  }
              });
            }
        });
      },
      getValue:function(){
        api.ajax({
            url: apiUrl+'api/Reflect/getValue',
            method: 'post',
            data: {
                values: {
                },
            }
        },function(ret, err){
            if (ret.status) {
              vm.wechat = ret.wechat;
              vm.handlingfee = ret.handlingfee;
            }
        });

      },
    }
  })
}

</script>
</html>
